------------------------------------------------------------------------------------------------------------------------------------------
      name:  <unnamed>
       log:  R:\personlig\fenellac\menarche_replication\analysis\temp/log-for-app-F-figure01-sensitivity-analysis.log
  log type:  text
 opened on:   2 May 2020, 15:16:51

. global plusdir "R:/personlig/fenellac/stata_ado/plus/" ;

. sysdir set PLUS $plusdir ;

. adopath ++ $plusdir ;
  [1]              "R:/personlig/fenellac/stata_ado/plus/"
  [2]  (BASE)      "C:\Program Files (x86)\Stata15\ado\base/"
  [3]  (SITE)      "C:\Program Files (x86)\Stata15\ado\site/"
  [4]              "."
  [5]  (PERSONAL)  "c:\ado\personal/"
  [6]  (PLUS)      "R:/personlig/fenellac/stata_ado/plus/"
  [7]  (OLDPLACE)  "c:\ado/"

. * install moremata ;
.  net from "R:/personlig/fenellac/stata_ado/plus/temp/moremata" ;
------------------------------------------------------------------------------------------------------------------------------------------
R:/personlig/fenellac/stata_ado/plus/temp/moremata\
(no title)
------------------------------------------------------------------------------------------------------------------------------------------

PACKAGES you could -net describe-:
    moremata          
------------------------------------------------------------------------------------------------------------------------------------------

. capture net uninstall moremata ;

. net install moremata ;
checking moremata consistency and verifying not already installed...
installing into R:/personlig/fenellac/stata_ado/plus\...
installation complete.

. * **************************************************************************** ;
. * This code replicates Appendix F, Figure 1.
> *
> * Paper: "Age of Marriage and Women's Political Engagement: Evidence from India"
> * Authors: Fenella Carpena, Francesca Jensenius
> * 
> * Code by Fenella Carpena
> * Last update: May 2, 2020
> * **************************************************************************** ;
. ****************************************************************************** ;
. * select the sample
> ****************************************************************************** ;
. use "./input/eligible-women-ihds02-lhs.dta", clear ;
(India Human Development Survey-II (IHDS-II), 2011-12, Eligible Women)

. merge 1:1 IDHH PERSONID using "./input/eligible-women-ihds02-rhs.dta" ;
(label DISTRICT already defined)
(label METRO6 already defined)
(label URBAN4_2011 already defined)
(label URBAN2011 already defined)
(label STATEID already defined)

    Result                           # of obs.
    -----------------------------------------
    not matched                             0
    matched                            39,523  (_merge==3)
    -----------------------------------------

. tab _merge ;

                 _merge |      Freq.     Percent        Cum.
------------------------+-----------------------------------
            matched (3) |     39,523      100.00      100.00
------------------------+-----------------------------------
                  Total |     39,523      100.00

. assert _merge == 3 ;

. drop _merge ;

. * keep only rural women ;
. keep if rural == 1 ;
(13,442 observations deleted)

. * keep only women who are married only once (i.e., have not ever remarried) ;
. drop if ever_remarried == 1 ;
(404 observations deleted)

.   * keep only women age of menarche between 11-18 (1st-99th pctile) ;
.  summ menarche_age ;

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
menarche_age |     25,630     13.9277    1.488429          1         30

. keep if menarche_age >= 11 & menarche_age <= 18 ;
(401 observations deleted)

. * generating district identifier ;
. egen dt_id = group(STATEID DISTID) ;

. ****************************************************************************** ;
. * set-up data for analysis 
> ****************************************************************************** ;
. * rename this variable to make it shorter ;
. ren num_children_with nchild ;

. ren years_schooling yrssch ;

. ren discuss_politics discuss ;

. ren member_pol_org member ;

. * label variables ;
.  label var attended "Attended village council meeting last year" ;

. label var discuss "Discusses politics and community with husband" ;

. label var member "Participates in a political organization" ;

. label var yrssch "Years of schooling" ;

. label var nchild "No. children living w/ respondent" ;

. label var menarche_age "Menarche age" ;

. * make sure the sample is the same across all regressions 
> * i.e., remove any observation which has missing values for the relevant variables, 
> * because otherwise, each regression has a different sample and the regressions
> * will not be comparable ;
.  foreach var of varlist 
> attended discuss member
> yrssch nchild
> menarche_age 
> height_measure age hindu muslim sc st obc mother_yrs_educ father_yrs_educ {;
  2.         drop if `var' == . ;
  3. } ;
(56 observations deleted)
(843 observations deleted)
(11 observations deleted)
(2 observations deleted)
(132 observations deleted)
(0 observations deleted)
(579 observations deleted)
(0 observations deleted)
(0 observations deleted)
(0 observations deleted)
(0 observations deleted)
(0 observations deleted)
(0 observations deleted)
(68 observations deleted)
(79 observations deleted)

.  * remove district FEs manually to ease estimation later ;
.  foreach var of varlist 
> attended discuss member
> yrssch nchild
> menarche_age 
> height_measure age hindu muslim sc st obc mother_yrs_educ father_yrs_educ { ;
  2.         qui reg `var' i.dt_id  ;
  3.         predict r`var', resid ;
  4.  } ;

. * control vars ;
. local rcvars "rheight_measure rage rhindu rmuslim rsc rst robc rmother_yrs_educ rfather_yrs_educ" ;

. ****************************************************************************** ;
. ****************************************************************************** ;
. *               MEDIATOR: YEARS OF EDUCATION
> ****************************************************************************** ;
. ****************************************************************************** ;
. ****************************************************************************** ;
. * Y: attended meeting, M: years_schooling
> ****************************************************************************** ;
. preserve ;

.  local mediator "yrssch" ;

. local yvar "attended" ;

.  local treat "menarche_age" ;

. medsens (regress r`mediator' r`treat' `rcvars' ) 
>                 (regress r`yvar' r`treat' r`mediator' `rcvars'), 
>                 treat(r`treat') mediate(r`mediator') sims(500) ;

      Source |       SS           df       MS      Number of obs   =    23,506
-------------+----------------------------------   F(10, 23495)    =   1370.89
       Model |  143512.279        10  14351.2279   Prob > F        =    0.0000
    Residual |  245958.489    23,495   10.468546   R-squared       =    0.3685
-------------+----------------------------------   Adj R-squared   =    0.3682
       Total |  389470.768    23,505  16.5696987   Root MSE        =    3.2355

----------------------------------------------------------------------------------
         ryrssch |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-----------------+----------------------------------------------------------------
   rmenarche_age |   .1173341   .0187786     6.25   0.000     .0805268    .1541415
 rheight_measure |   .0203012    .002604     7.80   0.000     .0151971    .0254053
            rage |  -.1309331   .0022296   -58.73   0.000    -.1353032   -.1265629
          rhindu |  -.0610753   .1240222    -0.49   0.622    -.3041669    .1820163
         rmuslim |  -1.118959   .1497678    -7.47   0.000    -1.412514   -.8254044
             rsc |  -1.484696   .0677963   -21.90   0.000    -1.617581   -1.351811
             rst |   -1.84514   .0963187   -19.16   0.000    -2.033931   -1.656349
            robc |  -.7457034   .0618358   -12.06   0.000    -.8669056   -.6245011
rmother_yrs_educ |   .2963721   .0110814    26.74   0.000     .2746518    .3180924
rfather_yrs_educ |   .3204427   .0065181    49.16   0.000     .3076668    .3332186
           _cons |  -8.28e-10   .0211035    -0.00   1.000    -.0413642    .0413642
----------------------------------------------------------------------------------

      Source |       SS           df       MS      Number of obs   =    23,506
-------------+----------------------------------   F(11, 23494)    =     17.39
       Model |  12.8445471        11   1.1676861   Prob > F        =    0.0000
    Residual |  1577.81942    23,494  .067158399   R-squared       =    0.0081
-------------+----------------------------------   Adj R-squared   =    0.0076
       Total |  1590.66397    23,505   .06767343   Root MSE        =    .25915

----------------------------------------------------------------------------------
rattended_panc~t |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-----------------+----------------------------------------------------------------
         ryrssch |   .0030876   .0005225     5.91   0.000     .0020634    .0041118
   rmenarche_age |    .003103   .0015053     2.06   0.039     .0001524    .0060535
 rheight_measure |   .0000359   .0002088     0.17   0.864    -.0003735    .0004452
            rage |   .0021758   .0001912    11.38   0.000     .0018009    .0025506
          rhindu |   .0111595   .0099336     1.12   0.261     -.008311    .0306301
         rmuslim |  -.0002083   .0120099    -0.02   0.986    -.0237486     .023332
             rsc |   .0313547   .0054853     5.72   0.000     .0206031    .0421062
             rst |   .0164198   .0077747     2.11   0.035     .0011809    .0316587
            robc |   .0051257   .0049681     1.03   0.302     -.004612    .0148635
rmother_yrs_educ |  -.0032856    .000901    -3.65   0.000    -.0050515   -.0015196
rfather_yrs_educ |   .0006204   .0005483     1.13   0.258    -.0004542     .001695
           _cons |  -3.32e-10   .0016903    -0.00   1.000    -.0033131    .0033131
----------------------------------------------------------------------------------
file C:\Users\fenellac\AppData\Local\Temp\51\ST_c3f0_000003.tmp saved


----------------------------------------------------------------
Sensitivity results
----------------------------------------------------------------
        Rho at which ACME = 0            |     .0385
        R^2_M*R^2_Y* at which ACME = 0:  |     .0015
        R^2_M~R^2_Y~ at which ACME = 0:  |     .0009
----------------------------------------------------------------
95% Confidence interval

. twoway rarea _med_updelta0 _med_lodelta0 _med_rho, bcolor(gs14) ||
> line _med_delta0 _med_rho, lcolor(black) lpattern(dash) ytitle("ACME") xtitle("Sensitivity parameter, {&rho}") legend(off) ;

. * save graph ;
. graph export "./output/figure-sensitivity-Y-`yvar'-M-`mediator'.png", replace ;
(file ./output/figure-sensitivity-Y-attended-M-yrssch.png written in PNG format)

.                                                                         * save data ;
. saveold "./temp/data-for-figure-sensitivity-Y-`yvar'-M-`mediator'.dta", replace version(12) ;
(saving in Stata 12 format, which can be read by Stata 11 or 12)
file ./temp/data-for-figure-sensitivity-Y-attended-M-yrssch.dta saved

. restore ;

.  ****************************************************************************** ;
. * Y: discusses politics at home,  M: years schooling
> ****************************************************************************** ;
. preserve ;

. local mediator "yrssch" ;

. local yvar "discuss" ;

.  local treat "menarche_age" ;

. medsens (regress r`mediator' r`treat' `rcvars' ) 
>                 (regress r`yvar' r`treat' r`mediator' `rcvars'), 
>                 treat(r`treat') mediate(r`mediator') sims(500) ;

      Source |       SS           df       MS      Number of obs   =    23,506
-------------+----------------------------------   F(10, 23495)    =   1370.89
       Model |  143512.279        10  14351.2279   Prob > F        =    0.0000
    Residual |  245958.489    23,495   10.468546   R-squared       =    0.3685
-------------+----------------------------------   Adj R-squared   =    0.3682
       Total |  389470.768    23,505  16.5696987   Root MSE        =    3.2355

----------------------------------------------------------------------------------
         ryrssch |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-----------------+----------------------------------------------------------------
   rmenarche_age |   .1173341   .0187786     6.25   0.000     .0805268    .1541415
 rheight_measure |   .0203012    .002604     7.80   0.000     .0151971    .0254053
            rage |  -.1309331   .0022296   -58.73   0.000    -.1353032   -.1265629
          rhindu |  -.0610753   .1240222    -0.49   0.622    -.3041669    .1820163
         rmuslim |  -1.118959   .1497678    -7.47   0.000    -1.412514   -.8254044
             rsc |  -1.484696   .0677963   -21.90   0.000    -1.617581   -1.351811
             rst |   -1.84514   .0963187   -19.16   0.000    -2.033931   -1.656349
            robc |  -.7457034   .0618358   -12.06   0.000    -.8669056   -.6245011
rmother_yrs_educ |   .2963721   .0110814    26.74   0.000     .2746518    .3180924
rfather_yrs_educ |   .3204427   .0065181    49.16   0.000     .3076668    .3332186
           _cons |  -8.28e-10   .0211035    -0.00   1.000    -.0413642    .0413642
----------------------------------------------------------------------------------

      Source |       SS           df       MS      Number of obs   =    23,506
-------------+----------------------------------   F(11, 23494)    =     15.52
       Model |  28.9987019        11  2.63624563   Prob > F        =    0.0000
    Residual |  3990.31716    23,494  .169844095   R-squared       =    0.0072
-------------+----------------------------------   Adj R-squared   =    0.0068
       Total |  4019.31586    23,505  .170998335   Root MSE        =    .41212

----------------------------------------------------------------------------------
        rdiscuss |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-----------------+----------------------------------------------------------------
         ryrssch |   .0065151    .000831     7.84   0.000     .0048863    .0081439
   rmenarche_age |   .0039219   .0023939     1.64   0.101    -.0007703    .0086141
 rheight_measure |   .0007129   .0003321     2.15   0.032     .0000619    .0013638
            rage |   .0011039   .0003041     3.63   0.000     .0005078       .0017
          rhindu |  -.0208201   .0157973    -1.32   0.188     -.051784    .0101437
         rmuslim |  -.0312138   .0190992    -1.63   0.102    -.0686495    .0062219
             rsc |  -.0213253   .0087232    -2.44   0.015    -.0384233   -.0042273
             rst |  -.0604032    .012364    -4.89   0.000    -.0846374    -.036169
            robc |  -.0191426   .0079006    -2.42   0.015    -.0346284   -.0036568
rmother_yrs_educ |   .0019739   .0014328     1.38   0.168    -.0008345    .0047823
rfather_yrs_educ |   .0006046   .0008719     0.69   0.488    -.0011044    .0023136
           _cons |  -6.40e-11    .002688    -0.00   1.000    -.0052687    .0052687
----------------------------------------------------------------------------------
file C:\Users\fenellac\AppData\Local\Temp\51\ST_c3f0_000004.tmp saved


----------------------------------------------------------------
Sensitivity results
----------------------------------------------------------------
        Rho at which ACME = 0            |     .0511
        R^2_M*R^2_Y* at which ACME = 0:  |     .0026
        R^2_M~R^2_Y~ at which ACME = 0:  |     .0016
----------------------------------------------------------------
95% Confidence interval

. twoway rarea _med_updelta0 _med_lodelta0 _med_rho, bcolor(gs14) ||
> line _med_delta0 _med_rho, lcolor(black) lpattern(dash) ytitle("ACME") xtitle("Sensitivity parameter, {&rho}") legend(off) ;

. * save graph ;
. graph export "./output/figure-sensitivity-Y-`yvar'-M-`mediator'.png", replace ;
(file ./output/figure-sensitivity-Y-discuss-M-yrssch.png written in PNG format)

.                         * save data ;
. saveold "./temp/data-for-figure-sensitivity-Y-`yvar'-M-`mediator'.dta", replace version(12) ;
(saving in Stata 12 format, which can be read by Stata 11 or 12)
file ./temp/data-for-figure-sensitivity-Y-discuss-M-yrssch.dta saved

. restore ;

. ****************************************************************************** ;
. * Y: member pol org,  M: years schooling
> ****************************************************************************** ;
. preserve ;

. local mediator "yrssch" ;

. local yvar "member" ;

.  local treat "menarche_age" ;

. medsens (regress r`mediator' r`treat' `rcvars' ) 
>                 (regress r`yvar' r`treat' r`mediator' `rcvars'), 
>                 treat(r`treat') mediate(r`mediator') sims(500) ;

      Source |       SS           df       MS      Number of obs   =    23,506
-------------+----------------------------------   F(10, 23495)    =   1370.89
       Model |  143512.279        10  14351.2279   Prob > F        =    0.0000
    Residual |  245958.489    23,495   10.468546   R-squared       =    0.3685
-------------+----------------------------------   Adj R-squared   =    0.3682
       Total |  389470.768    23,505  16.5696987   Root MSE        =    3.2355

----------------------------------------------------------------------------------
         ryrssch |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-----------------+----------------------------------------------------------------
   rmenarche_age |   .1173341   .0187786     6.25   0.000     .0805268    .1541415
 rheight_measure |   .0203012    .002604     7.80   0.000     .0151971    .0254053
            rage |  -.1309331   .0022296   -58.73   0.000    -.1353032   -.1265629
          rhindu |  -.0610753   .1240222    -0.49   0.622    -.3041669    .1820163
         rmuslim |  -1.118959   .1497678    -7.47   0.000    -1.412514   -.8254044
             rsc |  -1.484696   .0677963   -21.90   0.000    -1.617581   -1.351811
             rst |   -1.84514   .0963187   -19.16   0.000    -2.033931   -1.656349
            robc |  -.7457034   .0618358   -12.06   0.000    -.8669056   -.6245011
rmother_yrs_educ |   .2963721   .0110814    26.74   0.000     .2746518    .3180924
rfather_yrs_educ |   .3204427   .0065181    49.16   0.000     .3076668    .3332186
           _cons |  -8.28e-10   .0211035    -0.00   1.000    -.0413642    .0413642
----------------------------------------------------------------------------------

      Source |       SS           df       MS      Number of obs   =    23,506
-------------+----------------------------------   F(11, 23494)    =      3.85
       Model |   .28353668        11  .025776062   Prob > F        =    0.0000
    Residual |   157.43719    23,494  .006701166   R-squared       =    0.0018
-------------+----------------------------------   Adj R-squared   =    0.0013
       Total |  157.720727    23,505  .006710093   Root MSE        =    .08186

----------------------------------------------------------------------------------
         rmember |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-----------------+----------------------------------------------------------------
         ryrssch |   .0005591   .0001651     3.39   0.001     .0002356    .0008826
   rmenarche_age |   .0003531   .0004755     0.74   0.458    -.0005789    .0012851
 rheight_measure |   .0001208    .000066     1.83   0.067    -8.52e-06    .0002501
            rage |   .0002267   .0000604     3.75   0.000     .0001082    .0003451
          rhindu |  -.0037276   .0031379    -1.19   0.235    -.0098781    .0024228
         rmuslim |  -.0055928   .0037937    -1.47   0.140    -.0130287    .0018432
             rsc |   .0014982   .0017327     0.86   0.387    -.0018981    .0048944
             rst |   .0018829   .0024559     0.77   0.443    -.0029308    .0066966
            robc |   .0011145   .0015693     0.71   0.478    -.0019615    .0041904
rmother_yrs_educ |  -.0004947   .0002846    -1.74   0.082    -.0010526    .0000631
rfather_yrs_educ |   .0004937   .0001732     2.85   0.004     .0001542    .0008331
           _cons |  -1.02e-11   .0005339    -0.00   1.000    -.0010465    .0010465
----------------------------------------------------------------------------------
file C:\Users\fenellac\AppData\Local\Temp\51\ST_c3f0_000005.tmp saved


----------------------------------------------------------------
Sensitivity results
----------------------------------------------------------------
        Rho at which ACME = 0            |     .0221
        R^2_M*R^2_Y* at which ACME = 0:  |     .0005
        R^2_M~R^2_Y~ at which ACME = 0:  |     .0003
----------------------------------------------------------------
95% Confidence interval

. twoway rarea _med_updelta0 _med_lodelta0 _med_rho, bcolor(gs14) ||
> line _med_delta0 _med_rho, lcolor(black) lpattern(dash) ytitle("ACME") xtitle("Sensitivity parameter, {&rho}") legend(off) ;

. * save graph ;
. graph export "./output/figure-sensitivity-Y-`yvar'-M-`mediator'.png", replace ;
(file ./output/figure-sensitivity-Y-member-M-yrssch.png written in PNG format)

.                                         * save data ;
. saveold "./temp/data-for-figure-sensitivity-Y-`yvar'-M-`mediator'.dta", replace version(12) ;
(saving in Stata 12 format, which can be read by Stata 11 or 12)
file ./temp/data-for-figure-sensitivity-Y-member-M-yrssch.dta saved

. restore ;

. ****************************************************************************** ;
. ****************************************************************************** ;
. *               MEDIATOR: NUMBER OF CHILDREN LIVING WITH RESPONDENT 
> ****************************************************************************** ;
. ****************************************************************************** ;
. ****************************************************************************** ;
. * Y: attended meeting, M: # of children living w/ respondent 
> ****************************************************************************** ;
. preserve ;

. local mediator "nchild" ;

. local yvar "attended" ;

.  local treat "menarche_age" ;

. medsens (regress r`mediator' r`treat' `rcvars' ) 
>                 (regress r`yvar' r`treat' r`mediator' `rcvars'), 
>                 treat(r`treat') mediate(r`mediator') sims(500) ;

      Source |       SS           df       MS      Number of obs   =    23,506
-------------+----------------------------------   F(10, 23495)    =    111.34
       Model |  1799.06654        10  179.906654   Prob > F        =    0.0000
    Residual |  37964.0395    23,495  1.61583484   R-squared       =    0.0452
-------------+----------------------------------   Adj R-squared   =    0.0448
       Total |   39763.106    23,505  1.69168713   Root MSE        =    1.2712

----------------------------------------------------------------------------------
         rnchild |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-----------------+----------------------------------------------------------------
   rmenarche_age |  -.0280721   .0073777    -3.81   0.000    -.0425328   -.0136114
 rheight_measure |   .0014782   .0010231     1.44   0.148     -.000527    .0034835
            rage |   .0168332    .000876    19.22   0.000     .0151162    .0185501
          rhindu |   .0543084   .0487253     1.11   0.265    -.0411964    .1498133
         rmuslim |   .6887416   .0588401    11.71   0.000     .5734111    .8040721
             rsc |   .3396829   .0266355    12.75   0.000     .2874756    .3918903
             rst |   .2827683   .0378413     7.47   0.000     .2085969    .3569396
            robc |   .1410756   .0242938     5.81   0.000     .0934582     .188693
rmother_yrs_educ |  -.0174956   .0043536    -4.02   0.000     -.026029   -.0089622
rfather_yrs_educ |  -.0168556   .0025608    -6.58   0.000     -.021875   -.0118363
           _cons |   1.81e-09    .008291     0.00   1.000     -.016251     .016251
----------------------------------------------------------------------------------

      Source |       SS           df       MS      Number of obs   =    23,506
-------------+----------------------------------   F(11, 23494)    =     14.82
       Model |  10.9603919        11  .996399266   Prob > F        =    0.0000
    Residual |  1579.70358    23,494  .067238596   R-squared       =    0.0069
-------------+----------------------------------   Adj R-squared   =    0.0064
       Total |  1590.66397    23,505   .06767343   Root MSE        =     .2593

----------------------------------------------------------------------------------
rattended_panc~t |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-----------------+----------------------------------------------------------------
         rnchild |   .0034832   .0013308     2.62   0.009     .0008746    .0060917
   rmenarche_age |    .003563   .0015054     2.37   0.018     .0006123    .0065138
 rheight_measure |   .0000934   .0002087     0.45   0.654    -.0003157    .0005025
            rage |   .0017129   .0001801     9.51   0.000     .0013599    .0020658
          rhindu |   .0107818   .0099398     1.08   0.278    -.0087008    .0302644
         rmuslim |  -.0060622   .0120378    -0.50   0.615     -.029657    .0175327
             rsc |   .0255874   .0054522     4.69   0.000     .0149008     .036274
             rst |   .0097379   .0077284     1.26   0.208    -.0054104    .0248861
            robc |   .0023319   .0049593     0.47   0.638    -.0073886    .0120524
rmother_yrs_educ |  -.0023095   .0008884    -2.60   0.009    -.0040509   -.0005682
rfather_yrs_educ |   .0016685   .0005229     3.19   0.001     .0006437    .0026933
           _cons |  -3.41e-10   .0016913    -0.00   1.000    -.0033151    .0033151
----------------------------------------------------------------------------------
file C:\Users\fenellac\AppData\Local\Temp\51\ST_c3f0_000006.tmp saved


----------------------------------------------------------------
Sensitivity results
----------------------------------------------------------------
        Rho at which ACME = 0            |     .0171
        R^2_M*R^2_Y* at which ACME = 0:  |     .0003
        R^2_M~R^2_Y~ at which ACME = 0:  |     .0003
----------------------------------------------------------------
95% Confidence interval

. twoway rarea _med_updelta0 _med_lodelta0 _med_rho, bcolor(gs14) ||
> line _med_delta0 _med_rho, lcolor(black) lpattern(dash) ytitle("ACME") xtitle("Sensitivity parameter, {&rho}") legend(off) ;

. * save graph ;
. graph export "./output/figure-sensitivity-Y-`yvar'-M-`mediator'.png", replace ;
(file ./output/figure-sensitivity-Y-attended-M-nchild.png written in PNG format)

.                                 * save data ;
. saveold "./temp/data-for-figure-sensitivity-Y-`yvar'-M-`mediator'.dta", replace version(12) ;
(saving in Stata 12 format, which can be read by Stata 11 or 12)
file ./temp/data-for-figure-sensitivity-Y-attended-M-nchild.dta saved

. restore ;

. ****************************************************************************** ;
. * Y: discusses politics at home,  M: # of children living w/ respondent 
> ****************************************************************************** ;
. preserve ;

. local mediator "nchild" ;

. local yvar "discuss" ;

.  local treat "menarche_age" ;

. medsens (regress r`mediator' r`treat' `rcvars' ) 
>                 (regress r`yvar' r`treat' r`mediator' `rcvars'), 
>                 treat(r`treat') mediate(r`mediator') sims(500) ;

      Source |       SS           df       MS      Number of obs   =    23,506
-------------+----------------------------------   F(10, 23495)    =    111.34
       Model |  1799.06654        10  179.906654   Prob > F        =    0.0000
    Residual |  37964.0395    23,495  1.61583484   R-squared       =    0.0452
-------------+----------------------------------   Adj R-squared   =    0.0448
       Total |   39763.106    23,505  1.69168713   Root MSE        =    1.2712

----------------------------------------------------------------------------------
         rnchild |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-----------------+----------------------------------------------------------------
   rmenarche_age |  -.0280721   .0073777    -3.81   0.000    -.0425328   -.0136114
 rheight_measure |   .0014782   .0010231     1.44   0.148     -.000527    .0034835
            rage |   .0168332    .000876    19.22   0.000     .0151162    .0185501
          rhindu |   .0543084   .0487253     1.11   0.265    -.0411964    .1498133
         rmuslim |   .6887416   .0588401    11.71   0.000     .5734111    .8040721
             rsc |   .3396829   .0266355    12.75   0.000     .2874756    .3918903
             rst |   .2827683   .0378413     7.47   0.000     .2085969    .3569396
            robc |   .1410756   .0242938     5.81   0.000     .0934582     .188693
rmother_yrs_educ |  -.0174956   .0043536    -4.02   0.000     -.026029   -.0089622
rfather_yrs_educ |  -.0168556   .0025608    -6.58   0.000     -.021875   -.0118363
           _cons |   1.81e-09    .008291     0.00   1.000     -.016251     .016251
----------------------------------------------------------------------------------

      Source |       SS           df       MS      Number of obs   =    23,506
-------------+----------------------------------   F(11, 23494)    =     11.60
       Model |  21.7092987        11  1.97357261   Prob > F        =    0.0000
    Residual |  3997.60657    23,494  .170154361   R-squared       =    0.0054
-------------+----------------------------------   Adj R-squared   =    0.0049
       Total |  4019.31586    23,505  .170998335   Root MSE        =     .4125

----------------------------------------------------------------------------------
        rdiscuss |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-----------------+----------------------------------------------------------------
         rnchild |   .0091099   .0021171     4.30   0.000     .0049603    .0132595
   rmenarche_age |    .004942   .0023948     2.06   0.039      .000248    .0096361
 rheight_measure |   .0008317    .000332     2.50   0.012     .0001809    .0014824
            rage |   .0000975   .0002865     0.34   0.734     -.000464     .000659
          rhindu |  -.0217128   .0158121    -1.37   0.170    -.0527055    .0092799
         rmuslim |  -.0447783   .0191496    -2.34   0.019    -.0823127   -.0072439
             rsc |  -.0340927   .0086733    -3.93   0.000    -.0510929   -.0170926
             rst |  -.0750004   .0122943    -6.10   0.000    -.0990981   -.0509028
            robc |  -.0252861   .0078891    -3.21   0.001    -.0407494   -.0098229
rmother_yrs_educ |   .0040642   .0014133     2.88   0.004     .0012941    .0068343
rfather_yrs_educ |   .0028459   .0008318     3.42   0.001     .0012155    .0044762
           _cons |  -8.59e-11   .0026905    -0.00   1.000    -.0052735    .0052735
----------------------------------------------------------------------------------
file C:\Users\fenellac\AppData\Local\Temp\51\ST_c3f0_000007.tmp saved


----------------------------------------------------------------
Sensitivity results
----------------------------------------------------------------
        Rho at which ACME = 0            |     .0281
        R^2_M*R^2_Y* at which ACME = 0:  |     .0008
        R^2_M~R^2_Y~ at which ACME = 0:  |     .0007
----------------------------------------------------------------
95% Confidence interval

. twoway rarea _med_updelta0 _med_lodelta0 _med_rho, bcolor(gs14) ||
> line _med_delta0 _med_rho, lcolor(black) lpattern(dash) ytitle("ACME") xtitle("Sensitivity parameter, {&rho}") legend(off) ;

. * save graph ;
. graph export "./output/figure-sensitivity-Y-`yvar'-M-`mediator'.png", replace ;
(file ./output/figure-sensitivity-Y-discuss-M-nchild.png written in PNG format)

.                                         * save data ;
. saveold "./temp/data-for-figure-sensitivity-Y-`yvar'-M-`mediator'.dta", replace version(12) ;
(saving in Stata 12 format, which can be read by Stata 11 or 12)
file ./temp/data-for-figure-sensitivity-Y-discuss-M-nchild.dta saved

. restore ;

. ****************************************************************************** ;
. * Y: member pol org,  M: # of children living w/ respondent 
> ****************************************************************************** ;
. preserve;

.  local mediator "nchild" ;

. local yvar "member" ;

.  local treat "menarche_age" ;

. medsens (regress r`mediator' r`treat' `rcvars' ) 
>                 (regress r`yvar' r`treat' r`mediator' `rcvars'), 
>                 treat(r`treat') mediate(r`mediator') sims(500) ;

      Source |       SS           df       MS      Number of obs   =    23,506
-------------+----------------------------------   F(10, 23495)    =    111.34
       Model |  1799.06654        10  179.906654   Prob > F        =    0.0000
    Residual |  37964.0395    23,495  1.61583484   R-squared       =    0.0452
-------------+----------------------------------   Adj R-squared   =    0.0448
       Total |   39763.106    23,505  1.69168713   Root MSE        =    1.2712

----------------------------------------------------------------------------------
         rnchild |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-----------------+----------------------------------------------------------------
   rmenarche_age |  -.0280721   .0073777    -3.81   0.000    -.0425328   -.0136114
 rheight_measure |   .0014782   .0010231     1.44   0.148     -.000527    .0034835
            rage |   .0168332    .000876    19.22   0.000     .0151162    .0185501
          rhindu |   .0543084   .0487253     1.11   0.265    -.0411964    .1498133
         rmuslim |   .6887416   .0588401    11.71   0.000     .5734111    .8040721
             rsc |   .3396829   .0266355    12.75   0.000     .2874756    .3918903
             rst |   .2827683   .0378413     7.47   0.000     .2085969    .3569396
            robc |   .1410756   .0242938     5.81   0.000     .0934582     .188693
rmother_yrs_educ |  -.0174956   .0043536    -4.02   0.000     -.026029   -.0089622
rfather_yrs_educ |  -.0168556   .0025608    -6.58   0.000     -.021875   -.0118363
           _cons |   1.81e-09    .008291     0.00   1.000     -.016251     .016251
----------------------------------------------------------------------------------

      Source |       SS           df       MS      Number of obs   =    23,506
-------------+----------------------------------   F(11, 23494)    =      2.83
       Model |  .208721153        11   .01897465   Prob > F        =    0.0011
    Residual |  157.512006    23,494   .00670435   R-squared       =    0.0013
-------------+----------------------------------   Adj R-squared   =    0.0009
       Total |  157.720727    23,505  .006710093   Root MSE        =    .08188

----------------------------------------------------------------------------------
         rmember |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-----------------+----------------------------------------------------------------
         rnchild |  -.0002337   .0004202    -0.56   0.578    -.0010574      .00059
   rmenarche_age |   .0004122   .0004754     0.87   0.386    -.0005196    .0013439
 rheight_measure |   .0001325   .0000659     2.01   0.044     3.30e-06    .0002616
            rage |   .0001574   .0000569     2.77   0.006     .0000459    .0002688
          rhindu |  -.0037491   .0031387    -1.19   0.232    -.0099011    .0024029
         rmuslim |  -.0060575   .0038012    -1.59   0.111     -.013508    .0013931
             rsc |   .0007474   .0017216     0.43   0.664    -.0026271    .0041219
             rst |   .0009173   .0024404     0.38   0.707     -.003866    .0057007
            robc |   .0007305    .001566     0.47   0.641    -.0023389    .0037999
rmother_yrs_educ |  -.0003331   .0002805    -1.19   0.235     -.000883    .0002168
rfather_yrs_educ |   .0006689   .0001651     4.05   0.000     .0003453    .0009925
           _cons |  -1.02e-11   .0005341    -0.00   1.000    -.0010468    .0010468
----------------------------------------------------------------------------------
file C:\Users\fenellac\AppData\Local\Temp\51\ST_c3f0_000008.tmp saved


----------------------------------------------------------------
Sensitivity results
----------------------------------------------------------------
        Rho at which ACME = 0            |    -.0036
        R^2_M*R^2_Y* at which ACME = 0:  |         0
        R^2_M~R^2_Y~ at which ACME = 0:  |         0
----------------------------------------------------------------
95% Confidence interval

.                                         twoway rarea _med_updelta0 _med_lodelta0 _med_rho, bcolor(gs14) ||
> line _med_delta0 _med_rho, lcolor(black) lpattern(dash) ytitle("ACME") xtitle("Sensitivity parameter, {&rho}") legend(off) ;

. * save graph ;
. graph export "./output/figure-sensitivity-Y-`yvar'-M-`mediator'.png", replace ;
(file ./output/figure-sensitivity-Y-member-M-nchild.png written in PNG format)

.                                 * save data ;
. saveold "./temp/data-for-figure-sensitivity-Y-`yvar'-M-`mediator'.dta", replace version(12) ;
(saving in Stata 12 format, which can be read by Stata 11 or 12)
file ./temp/data-for-figure-sensitivity-Y-member-M-nchild.dta saved

. restore ;

. log close ;
      name:  <unnamed>
       log:  R:\personlig\fenellac\menarche_replication\analysis\temp/log-for-app-F-figure01-sensitivity-analysis.log
  log type:  text
 closed on:   2 May 2020, 19:39:58
------------------------------------------------------------------------------------------------------------------------------------------
